import common.DefaultPublisher;
import common.Event;
import common.NotifyCenter;
import common.SlowEvent;
import common.my.EatEvent;
import common.my.MyEvent;
import common.my.MySubscriber;

public class Start {
    public static void main(String[] args) {
        MySubscriber mySubscriber = new MySubscriber();
        MyEvent myEvent = new MyEvent();
        EatEvent eatEvent = new EatEvent();
        DefaultPublisher publisher = new DefaultPublisher();


        publisher.addSubscriber(mySubscriber);
        publisher.init(myEvent.getClass(),1000);
        publisher.publish(myEvent);
        publisher.publish(eatEvent);
        publisher.start();
        try {
            Thread.sleep(2000000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        NotifyCenter.registerToSharePublisher(TestSlowEvent.class);


    }

    private static class TestSlowEvent extends SlowEvent {

    }

    private static class TestEvent extends Event {

        @Override
        public long sequence() {
            return System.currentTimeMillis();
        }
    }

}
